package com.sq.gulimall.cart.config;

import com.sq.gulimall.cart.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class GulimallWebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册表中添加自定义的拦截器
        registry.addInterceptor(new CartInterceptor()).addPathPatterns("/**");// 拦截器要拦截所有请求

    }
}
